<?php
	if(isset($_POST['t_a_sandi_baru'])&&isset($_POST['t_a_sandi_baru2'])&&isset($_POST['t_a_sandi_lama'])){
		if (strlen($_POST['t_a_sandi_baru'])<6 and strlen($_POST['t_a_sandi_baru'])<6){
			echo "Minimal Sandi 6 karakter<br/>";
		}else if ($_POST['t_a_sandi_baru']!=$_POST['t_a_sandi_baru2']){
			echo "Sandi Baru Tidak Cocok<br/>";
		}else if (strlen($_POST['t_a_sandi_baru'])>=6 and strlen($_POST['t_a_sandi_baru'])>=6){
			if ($_POST['t_a_sandi_baru']==$_POST['t_a_sandi_baru2']){
				if (MD5($_POST['t_a_sandi_lama'])!=$_SESSION['PASSWORD_US']){
				echo "Sandi Lama Salah";
				}else{
					$passwordbaru = md5(htmlspecialchars($_POST['t_a_sandi_baru']));
					$updateakun = "UPDATE USER_SPM SET PASSWORD_US = '$passwordbaru' WHERE ID_US = '$_SESSION[ID_US]'";
        			$hasilupdateakun = mysql_query($updateakun);
					if ($hasilupdateakun){
						 echo "<p>Proses Update Sukses . Silahkan Login Kembali</p>";
						 ?><meta http-equiv="refresh" content="3;url='../logout.php'"><?php
					}else echo "<p>Proses Update Gagal</p>";
				}
			}
		}		
	}else{
		echo "HARAP DI ISI(*)";
	}
?>

<?php
if(!defined('GbIncl2')){ ?>
<meta http-equiv="refresh" content="0;url=../spm-itats/block.php" />
<?php }else{ if ($_SESSION['AKUN']=='1'){?>
                            <form id="f_s_akun" name="f_s_akun" method="post" action="">
                                <table width="55%" border="2">
                                    <tr>
                                        <th scope="row" width="70%"><label for="t_a_id">ID PENGGUNA</label></th>
                                        <th width="30%"><?php echo $_SESSION['ID_US']?></th>
                                    </tr>
                                    <tr>
                                        <th scope="row"><label for="t_a_nama">NAMA</label></th>
                                        <th><?php echo $_SESSION['NAMA_US']?></th>
                                    </tr>
                                    <tr>
                                        <th scope="row"><label for="t_a_sandi_baru">MASUKKAN SANDI BARU(*)</label></th>
                                        <th><input type="text" name="t_a_sandi_baru" id="t_a_sandi_baru" /></th>
                                    </tr>
                                    <tr>
                                        <th scope="row"><label for="t_a_sandi_baru2">MASUKKAN SANDI BARU LAGI(*)</label>      </th>
                                        <th><input type="text" name="t_a_sandi_baru2" id="t_a_sandi_baru2" /></th>
                                    </tr>
                                    <tr>
                                        <th scope="row"><label for="t_a_sandi_lama">MASUKKAN SANDI LAMA(*)</label></th>
                                        <th><input type="password" name="t_a_sandi_lama" id="t_a_sandi_lama"/></th>
                                    </tr>
                                    <tr>
                                        <th scope="row">&nbsp;</th>
                                        <th class="right"><input type="submit" name="submit" id="b_a_update" class="button" value="Perbarui" /></th>
                                    </tr>
                                </table>
                            </form>
        <?php } else {?>
        <meta http-equiv="refresh" content="0;url=/spm-itats/cpanel/block.php" />
        <?php }?>
        <?php }?>
        <?php
/*

*/
?>